package com.example.work2

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

class FxFragment : Fragment(){
    private val p_msgList=ArrayList<P_Msg>()
    private var adapter:FxAdapter?=null
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view=inflater.inflate(R.layout.fx_fragment, container, false)
        initPMSG()
        val wc=view.findViewById(R.id.fxView) as RecyclerView
        val layoutManager=LinearLayoutManager(activity)
        wc.layoutManager=layoutManager
        adapter= FxAdapter(p_msgList)
        wc.adapter=adapter
        return view
    }
    private fun initPMSG(){
        p_msgList.add(P_Msg("朋友圈",R.mipmap.fx1))
        p_msgList.add(P_Msg("直播",R.mipmap.fx2))
        p_msgList.add(P_Msg("扫一扫",R.mipmap.fx3))
        p_msgList.add(P_Msg("摇一摇",R.mipmap.fx4))
        p_msgList.add(P_Msg("看一看",R.mipmap.fx5))
        p_msgList.add(P_Msg("搜一搜",R.mipmap.fx6))
        p_msgList.add(P_Msg("附近",R.mipmap.fx7))
    }
}